import { useUserStore } from "@/store/useUserStore";
import { redirect } from "react-router";

export function requireAuth() {
  const { isAuthenticated } = useUserStore.getState();

  if (!isAuthenticated) {
    throw redirect("/login");
  }

  return null;
}
